package com.fcscs.cservice.web;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import sun.misc.BASE64Encoder;

import com.fcscs.cservice.common.CServiceCommonEnums;
import com.fcscs.cservice.domain.model.BookingIdAndStatus;
import com.fcscs.cservice.domain.model.NonInHouseGuestProfile;
import com.fcscs.cservice.service.BookingManager;
import com.fcscs.cservice.service.CuisineTypeManager;
import com.fcscs.cservice.service.RestaurantManager;
import com.fcscs.cservice.service.RestaurantPictureManager;
import com.fcscs.cservice.ws.client.bookingservice.AdvancedFindBookingsClient;
import com.fcscs.cservice.ws.client.bookingservice.CreateBookingClient;
import com.fcscs.cservice.ws.client.bookingservice.GetBookingHistroyClient;
import com.fcscs.cservice.ws.client.bookingservice.GetRestaurantsClient;
import com.fcscs.cservice.ws.client.bookingservice.GetUpdateBookingStatusClient;
import com.fcscs.cservice.ws.client.bookingservice.SimpleFindBookingsClient;
import com.fcscs.cservice.ws.client.bookingservice.UpdateBookingClient;
import com.fcscs.cservice.ws.client.commonservice.GetAdvertisementClient;
import com.fcscs.cservice.ws.client.commonservice.GetCountriesClient;
import com.fcscs.cservice.ws.client.commonservice.GetFileClient;
import com.fcscs.cservice.ws.client.commonservice.GetMainMenuClient;
import com.fcscs.cservice.ws.client.commonservice.GetReservationConfClient;
import com.fcscs.cservice.ws.client.commonservice.GetStatesClient;
import com.fcscs.cservice.ws.client.commonservice.GetThemesClient;
import com.fcscs.cservice.ws.client.guestprofileservice.FindGuestProfileClient;
import com.fcscs.cservice.ws.client.guestprofileservice.GetGuestProfileClient;
import com.fcscs.cservice.ws.client.guestprofileservice.UpdateGuestProfileClient;
import com.fcscs.cservice.ws.client.inroomservice.GetBillOptionsClient;
import com.fcscs.cservice.ws.client.inroomservice.GetChargeCategoriesClient;
import com.fcscs.cservice.ws.client.inroomservice.GetSpyciesClient;
import com.fcscs.cservice.ws.client.pmsservice.InterfaceStatusClient;
import com.fcscs.cservice.ws.client.reservationservice.AdvanceFindReservationsClient;
import com.fcscs.cservice.ws.client.reservationservice.ExpressCheckoutClient;
import com.fcscs.cservice.ws.client.reservationservice.FindReservationsClient;
import com.fcscs.cservice.ws.client.reservationservice.GetFolioClient;
import com.fcscs.cservice.ws.client.reservationservice.GetMessagesClient;
import com.fcscs.cservice.ws.client.reservationservice.GetRCClient;
import com.fcscs.cservice.ws.client.reservationservice.GetReservationClient;
import com.fcscs.cservice.ws.client.reservationservice.UpdateRCClient;
import com.fcscs.cservice.ws.schema.bookingservice.AdvancedFindBookingsRequest;
import com.fcscs.cservice.ws.schema.bookingservice.CreateBookingRequest;
import com.fcscs.cservice.ws.schema.bookingservice.GetBookingHistoryRequest;
import com.fcscs.cservice.ws.schema.bookingservice.GetRestaurantsRequest;
import com.fcscs.cservice.ws.schema.bookingservice.SimpleFindBookingsRequest;
import com.fcscs.cservice.ws.schema.bookingservice.UpdateBookingRequest;
import com.fcscs.cservice.ws.schema.bookingservice.UpdateBookingStatusRequest;
import com.fcscs.cservice.ws.schema.commonservice.GetAdvertisementsRequest;
import com.fcscs.cservice.ws.schema.commonservice.GetCountriesRequest;
import com.fcscs.cservice.ws.schema.commonservice.GetFileRequest;
import com.fcscs.cservice.ws.schema.commonservice.GetMainMenuRequest;
import com.fcscs.cservice.ws.schema.commonservice.GetReservationConfRequest;
import com.fcscs.cservice.ws.schema.commonservice.GetStatesRequest;
import com.fcscs.cservice.ws.schema.commonservice.GetThemeRequest;
import com.fcscs.cservice.ws.schema.guestprofileservice.FindGuestProfileRequest;
import com.fcscs.cservice.ws.schema.guestprofileservice.FindGuestProfileResponse;
import com.fcscs.cservice.ws.schema.guestprofileservice.GetGuestProfileRequest;
import com.fcscs.cservice.ws.schema.guestprofileservice.GetGuestProfileResponse;
import com.fcscs.cservice.ws.schema.guestprofileservice.UpdateGuestProfileRequest;
import com.fcscs.cservice.ws.schema.guestprofileservice.UpdateGuestProfileResponse;
import com.fcscs.cservice.ws.schema.inroomservice.GetBillOptionsRequest;
import com.fcscs.cservice.ws.schema.inroomservice.GetChargeCategoriesRequest;
import com.fcscs.cservice.ws.schema.inroomservice.GetSpiciesRequest;
import com.fcscs.cservice.ws.schema.pmsservice.InterfaceStatusRequest;
import com.fcscs.cservice.ws.schema.reservationservice.AdvanceFindReservationsRequest;
import com.fcscs.cservice.ws.schema.reservationservice.AdvanceFindReservationsResponse;
import com.fcscs.cservice.ws.schema.reservationservice.ExpressCheckOutRequest;
import com.fcscs.cservice.ws.schema.reservationservice.FindReservationsRequest;
import com.fcscs.cservice.ws.schema.reservationservice.FindReservationsResponse;
import com.fcscs.cservice.ws.schema.reservationservice.GetFolioRequest;
import com.fcscs.cservice.ws.schema.reservationservice.GetMessagesRequest;
import com.fcscs.cservice.ws.schema.reservationservice.GetRCRequest;
import com.fcscs.cservice.ws.schema.reservationservice.GetRCResponse;
import com.fcscs.cservice.ws.schema.reservationservice.GetReservationRequest;
import com.fcscs.cservice.ws.schema.reservationservice.GetReservationResponse;
import com.fcscs.cservice.ws.schema.reservationservice.UpdateRCRequest;
import com.fcscs.cservice.ws.schema.reservationservice.UpdateRCResponse;
import com.fcscs.share.common.ShareEnums.WSSource;
import com.fcscs.share.service.MiscDBManager;
import com.fcscs.ws.client.coreservice.GetAuthorityClient;
import com.fcscs.ws.client.securityservice.LoginClient;
import com.fcscs.ws.client.securityservice.PropertyLanguageClient;
import com.fcscs.ws.schemas.coreservice.GetAuthorityRequest;
import com.fcscs.ws.schemas.coreservice.GetAuthorityResponse;
import com.fcscs.ws.schemas.coreservice.GetAuthorityResponse.Authority;
import com.fcscs.ws.schemas.securityservice.LoginRequest;
import com.fcscs.ws.schemas.securityservice.LoginResponse;
import com.fcscs.ws.schemas.securityservice.PropertyLanguageRequest;
import com.fcscs.ws.schemas.securityservice.PropertyLanguageResponse;

@Controller
public class WebServiceController {

	@Autowired
	LoginClient logCln;

	@Autowired
	FindReservationsClient fRresCln;

	@Autowired
	AdvanceFindReservationsClient afRresCln;

	@Autowired
	GetReservationClient getRresCln;

	@Autowired
	GetRCClient getRCCln;

	@Autowired
	UpdateRCClient uptRCCln;

	@Autowired
	FindGuestProfileClient findGPCln;

	@Autowired
	GetGuestProfileClient getGPCln;

	@Autowired
	UpdateGuestProfileClient uptGPCln;

	@Autowired
	GetReservationConfClient getRsvConfCln;

	@Autowired
	GetCountriesClient getCntCln;

	@Autowired
	GetStatesClient getStCln;

	@Autowired
	GetRestaurantsClient getRestaurantsCln;

	@Autowired
	GetUpdateBookingStatusClient getUpdateBookingStatusCln;

	@Autowired
	GetBookingHistroyClient bookingHistoryCln;

	@Autowired
	CreateBookingClient createBookingCln;

	@Autowired
	CuisineTypeManager cuisineMgr;

	@Autowired
	RestaurantManager restMgr;

	@Autowired
	RestaurantPictureManager restpicMgr;

	@Autowired
	BookingManager bookMgr;

	@Autowired
	MiscDBManager miscMgr;

	@Autowired
	UpdateBookingClient updateBkCln;

	static Logger LOGGER = Logger.getLogger(WebServiceController.class);

	public byte[] getBytes(Resource res) throws IOException {
		File file = res.getFile();
		if (file.exists()) {
			FileInputStream fin = null;
			try {
				fin = new FileInputStream(file);
				byte fileContent[] = new byte[(int) file.length()];
				fin.read(fileContent);
				fin.close();
				return fileContent;
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return null;
	}

	@RequestMapping("/ws/findReservations.do")
	public void testFindReservations(@RequestParam("term") String term) {
		FindReservationsRequest req = new FindReservationsRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setTerm(term);
		req.setDate(new Date());
		req.setStart(0);
		req.setNumResults(100);
		System.out.println("--------------findResv: " + term);
		FindReservationsResponse resp = fRresCln.findResv(req);
		System.out.println("--------------resp:" + resp.getTotalCnt());
	}

	@RequestMapping("/ws/aFindReservations.do")
	public void testAFindReservations(@RequestParam("term") String term) {
		AdvanceFindReservationsRequest req = new AdvanceFindReservationsRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setFirstname(term);
		req.setStart(0);
		req.setNumResults(100);
		System.out.println("--------------findResv: " + term);
		AdvanceFindReservationsResponse resp = afRresCln.findResv(req);
		System.out.println("--------------resp:" + resp.getTotalCnt());
	}

	@RequestMapping("/ws/getReservation.do")
	public void testGetReservation(@RequestParam("id") long id) {
		GetReservationRequest req = new GetReservationRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setReservationId(id);
		System.out.println("--------------findResv: " + id);
		GetReservationResponse resp = getRresCln.findResv(req);
		System.out.println("--------------resp:" + resp.getReservationView().getReservationViewId());
	}

	@RequestMapping("/ws/getRC.do")
	public void testGetRC(@RequestParam("id") long id) {
		GetRCRequest req = new GetRCRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setRcId(id);
		System.out.println("--------------findResv: " + id);
		GetRCResponse resp = getRCCln.findResv(req);
		System.out.println("--------------resp:" + resp.getRcView().getRcViewId());
	}

	@RequestMapping("/ws/findGuestProfile.do")
	public void testFindGuestProfile(@RequestParam("fname") String fName, @RequestParam("lname") String lName) {
		FindGuestProfileRequest req = new FindGuestProfileRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setFirstName(fName);
		req.setLastName(lName);
		req.setStart(0);
		req.setNumResults(100);
		System.out.println("--------------findGP: " + fName + "%, " + lName + "%");
		FindGuestProfileResponse resp = findGPCln.findGP(req);
		System.out.println("--------------resp:" + resp.getTotalCnt());
	}

	@RequestMapping("/ws/getGuestProfile.do")
	public void testGetGuestProfile(@RequestParam("id") long id) {
		GetGuestProfileRequest req = new GetGuestProfileRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setGuestProfileId(id);
		System.out.println("--------------findResv: " + id);
		GetGuestProfileResponse resp = getGPCln.getGP(req);
		System.out.println("--------------resp:" + resp.getGuestProfileView().getGuestProfileViewId());
	}

	@Value("/dummy/dummy_sign.bmp")
	Resource dummySign;

	@Value("/dummy/dummy_initial.bmp")
	Resource dummyInitial;

	@RequestMapping("/ws/updateRC.do")
	public void testUpdateRC(@RequestParam("id") long id) throws IOException {
		GetRCRequest req = new GetRCRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setRcId(id);
		GetRCResponse resp = getRCCln.findResv(req);

		UpdateRCRequest req2 = new UpdateRCRequest();
		req2.setRequestType(CServiceCommonEnums.UpdateRCRequestType.EXPRESS_CHECKIN.toString());

		req2.setInitialFile(new BASE64Encoder().encode(getBytes(dummyInitial)));
		req2.setSignatureFile(new BASE64Encoder().encode(getBytes(dummySign)));

		req2.setFcsUserId(LoginClient.userId);
		req2.setWsSessionId(LoginClient.sessionId);
		req2.setRcView(resp.getRcView());
		System.out.println("--------------findResv: " + id);
		UpdateRCResponse resp2 = uptRCCln.updateRC(req2);
		System.out.println("--------------resp:" + resp2.isSuccess());
	}

	@RequestMapping("/ws/updateGuestProfile.do")
	public void testUpdateGuestProfile(@RequestParam("id") long id) {
		GetGuestProfileRequest req = new GetGuestProfileRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setGuestProfileId(id);
		System.out.println("--------------findResv: " + id);
		GetGuestProfileResponse resp = getGPCln.getGP(req);

		UpdateGuestProfileRequest req2 = new UpdateGuestProfileRequest();
		req2.setFcsUserId(LoginClient.userId);
		req2.setWsSessionId(LoginClient.sessionId);
		req2.setGuestProfileView(resp.getGuestProfileView());
		System.out.println("--------------findResv: " + id);
		UpdateGuestProfileResponse resp2 = uptGPCln.updateGP(req2);
		System.out.println("--------------resp:" + resp2.isSuccess());
	}

	@RequestMapping("/ws/login.do")
	public void testLogin(@RequestParam("username") String username, @RequestParam("password") String pwd,
			@RequestParam("propId") long propId) {
		LOGGER.debug("--------------login username: " + username);

		LoginRequest lr = new LoginRequest();
		lr.setUsername(username);
		lr.setPassword(pwd);
		lr.setPropId(propId);
		/*BaseOutboundCommunicator lc = (BaseOutboundCommunicator) ApplicationContextHolder
				.getBeanFromContext("outboundCommunicator");*/
		lr.setIp("127.0.0.1");//lc.getIP());
		lr.setDeviceType("ANDROID");
		lr.setDeviceId("AA:BB:CC:DD:EE");
		lr.setSource(WSSource.MSERVICE.toString());
		lr.setLanguageCode("");

		LoginResponse resp = logCln.loginRequest(lr);
		LOGGER.debug("--------------resp:" + resp.getFcsUserId() + " : " + resp.getWsSessionId());

	}
	
	@Autowired
	PropertyLanguageClient plCln;
	
	@RequestMapping("/ws/propLang.do")
	public void testPropLang(@RequestParam("propId") long propId) {
		PropertyLanguageRequest lr = new PropertyLanguageRequest();
		lr.setPropId(propId);

		PropertyLanguageResponse resp = plCln.getPropLang(lr);

		System.out.println("--------------resp:" + resp.getLanguageList());
	}
	
	@Autowired
	private GetAuthorityClient gACln;
	
	@RequestMapping("/ws/getAuths.do")
	public void testGAuth(@RequestParam("orgId") long orgId, @RequestParam("propId") long propId) {
		GetAuthorityRequest req = new GetAuthorityRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		GetAuthorityResponse resp = (GetAuthorityResponse) gACln.getAuthorityRequest(req);
		for (Authority ua : resp.getAuthorityList()) {
			System.out.println("--------------Auth:" + ua.getName() + "  :prod:" + ua.getProduct() + "   :type:"
					+ ua.getType());
		}
	}

	@Autowired
	private GetFolioClient gfolioCln;

	@RequestMapping("/ws/getfolio.do")
	public void testGetFolio(@RequestParam("id") long folioId) {
		GetFolioRequest req = new GetFolioRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setFolioId(folioId);
		gfolioCln.getFolio(req);
	}

	@Autowired
	private ExpressCheckoutClient eccCln;

	@RequestMapping("/ws/expresscc.do")
	public void testExpressCheckout(@RequestParam("id") long folioId, HttpServletRequest request,
			HttpServletResponse resp) {
		ExpressCheckOutRequest req = new ExpressCheckOutRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setFolioId(folioId);
		req.setCheckoutType("AUTO");
		req.setPaymentMethodId(2L);
		req.setRemarks("urgent");
		String path = request.getSession().getServletContext().getRealPath("/dummy/dummy_logo.png");
		File file = new File(path);

		FileInputStream fin = null;
		try {
			fin = new FileInputStream(file);
			byte fileContent[] = new byte[(int) file.length()];
			fin.read(fileContent);
			String sign = new BASE64Encoder().encode(fileContent);
			req.setSignatureFile(sign);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

		eccCln.checkout(req);
	}

	@Autowired
	private GetMessagesClient gMsgsCln;

	@RequestMapping("/ws/getmsgs.do")
	public void testGetMessages(@RequestParam("id") long reservationId) {
		GetMessagesRequest req = new GetMessagesRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setReservationId(reservationId);
		gMsgsCln.getMessages(req);
	}

	@RequestMapping("/ws/getRsvConf.do")
	public void testGetRsvConf() {
		GetReservationConfRequest req = new GetReservationConfRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getRsvConfCln.getRsvConf(req);
	}

	@RequestMapping("/ws/getCountries.do")
	public void testGetCountries() {
		GetCountriesRequest req = new GetCountriesRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getCntCln.getCountries(req);
	}

	@RequestMapping("/ws/getStates.do")
	public void testGetStates(@RequestParam("countryId") long countryId) {
		GetStatesRequest req = new GetStatesRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setCountryId(countryId);
		getStCln.getStates(req);
	}

	@Autowired
	private SimpleFindBookingsClient simpleFBCln;

	@RequestMapping("/ws/simplefb.do")
	public void testSimpleFindBookings(@RequestParam(value= "t", required = false) String term, @RequestParam(value="r", required = false) Long restaurantId) {
		SimpleFindBookingsRequest req = new SimpleFindBookingsRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setStart(0);
		req.setNumResults(10);
		req.setTerm(term);
		req.setRestaurantId(restaurantId);
		simpleFBCln.simpleFindBookings(req);
	}

	@Autowired
	private AdvancedFindBookingsClient advFBCln;

	@RequestMapping("/ws/advancefb.do")
	public void testAdvancedFindBookings(@RequestParam(value= "f", required = false) String firstName, @RequestParam(value= "l", required = false) String lastName,
			@RequestParam(value= "m", required = false) String mobileNo, @RequestParam(value= "r", required = false) Long restaurantId, @RequestParam(value= "d", required = false) String date) {
		AdvancedFindBookingsRequest req = new AdvancedFindBookingsRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setStart(0);
		req.setNumResults(10);
		req.setFirstName(firstName);
		req.setLastName(lastName);
		req.setMobileNo(mobileNo);
		req.setRestaurantId(restaurantId);
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", java.util.Locale.US);
		Date d = null;
		try {
			d = sdf.parse(date);
		} catch (Exception e) {
			e.printStackTrace();
		}
		req.setReservationDate(d);
		advFBCln.advancedFindBookings(req);
	}

	@RequestMapping("/ws/getRestaurants.do")
	public void testGetRestaurants() {
		GetRestaurantsRequest req = new GetRestaurantsRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getRestaurantsCln.getRestaurants(req);
	}

	@RequestMapping("/ws/getUpdateBookingStatus.do")
	public void testGetUpdateBookingStatus() {

		UpdateBookingStatusRequest req = new UpdateBookingStatusRequest();
		List<BookingIdAndStatus> list = new ArrayList<BookingIdAndStatus>();
		BookingIdAndStatus bs1 = new BookingIdAndStatus();
		bs1.setBookingId(Long.valueOf(1));
		bs1.setBookingStatus("Cancel");
		list.add(bs1);
		BookingIdAndStatus bs2 = new BookingIdAndStatus();
		bs2.setBookingId(Long.valueOf(2));
		bs2.setBookingStatus("Pending");
		list.add(bs2);
		req.setBookingIdAndStatuList(list);
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getUpdateBookingStatusCln.getUpdateBookingStatus(req);
	}

	@RequestMapping("/ws/getBookingHistory.do")
	public void testGetBookingHistory() {

		GetBookingHistoryRequest req = new GetBookingHistoryRequest();
		req.setGuestId(1);
		req.setNumResults(15);
		req.setStart(0);
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		bookingHistoryCln.getBookingHistory(req);
	}

	@RequestMapping("/ws/getUpdateBooking.do")
	public void testUpdateBooking(){
		
		UpdateBookingRequest req = new UpdateBookingRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setRestaurantId(1);
		req.setBookingId(7);
		req.setInHoGuestProId(3);
//		req.setReservationDate(new Date());
//		req.setArriveDate(new Date());
//		req.setDepartureDate(new Date());
//		req.setBookingStatus("COMPLETED");
//		req.setDepartureDate(new Date());
//		req.setInHoGuestProId(1);
//		List<String> lis = new ArrayList<String>();
//		lis.add("EMAIL");
//		req.setNotifyList(lis);
//		req.setNoOfGuest(100);
//		req.setNote("Hello world");
//		req.setReservationDate(new Date());
//		req.setSmoking(Boolean.FALSE);
		updateBkCln.getUpdateBooking(req);
	}
	
	@RequestMapping("/ws/getCreateBooking.do")
	public void testCreateBooking() {

		CreateBookingRequest req = new CreateBookingRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setReservationDate(new Date());
		req.setArriveDate(new Date());
		req.setDepartureDate(new Date());
		req.setBookingStatus("COMPLETED");
		req.setDepartureDate(new Date());
		req.setGuestType("IN_HOUSE_GUEST");
		List<String> lis = new ArrayList<String>();
		lis.add("EMAIL");
		req.setNotifyList(lis);
		req.setInHoGuestProId(Long.valueOf(1));

		NonInHouseGuestProfile nonIn = new NonInHouseGuestProfile();
		nonIn.setEmailAddress("ZhangSan@fds.com");
		nonIn.setFirstName("Ryan");
		nonIn.setLastName("Han");
		nonIn.setPhoneNumber("123456789");
//		req.setNonInHouseGuestProfile(nonIn);
		req.setNoOfGuest(10);
		req.setNote("Hello world");
		req.setReservationDate(new Date());
		req.setRestaurantId(1);
		req.setSmoking(Boolean.FALSE);
		createBookingCln.getCreateBooking(req);
	}

	@RequestMapping("/ws/getCreateBooking1.do")
	public void testUpdateCreatingBooking() {

		CreateBookingRequest req = new CreateBookingRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setArriveDate(new Date());
		req.setBookingStatus("Complete");
		req.setDepartureDate(new Date());
		req.setGuestType("In House");
		req.setInHoGuestProId(Long.valueOf(1));

		NonInHouseGuestProfile nonIn = new NonInHouseGuestProfile();
		nonIn.setEmailAddress("ZhangSan@fds.com");
		nonIn.setFirstName("Ryan");
		nonIn.setLastName("Han");
		nonIn.setPhoneNumber("123456789");
		req.setNonInHouseGuestProfile(nonIn);
		req.setNoOfGuest(10);
		req.setNote("Hello world");
		req.setReservationDate(new Date());
		req.setRestaurantId(1);
		req.setSmoking(Boolean.FALSE);

		createBookingCln.getCreateBooking(req);
	}
	
	@Autowired
	GetFileClient getFileCln;
	
	@RequestMapping("/ws/getfile.do")
	public void testGetFile(@RequestParam("t") String type, @RequestParam("id") long id) {
		
		GetFileRequest req = new GetFileRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		req.setFileId(id);
		req.setFileType(type);
		getFileCln.getFile(req);
		
	}
	
	@Autowired
	GetAdvertisementClient getAdCln;
	
	@RequestMapping("/ws/getad.do")
	public void testGetAd() {
		GetAdvertisementsRequest req = new GetAdvertisementsRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getAdCln.test(req);
	}
	
	@Autowired
	GetSpyciesClient getSPCln;
	
	@RequestMapping("/ws/getsp.do")
	public void testGetSP() {
		GetSpiciesRequest req = new GetSpiciesRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getSPCln.test(req);
	}
	
	@Autowired
	GetBillOptionsClient getBillCln;
	
	@RequestMapping("/ws/getbill.do")
	public void testGetBill() {
		GetBillOptionsRequest req = new GetBillOptionsRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getBillCln.test(req);
	}
	
	@Autowired
	GetThemesClient getthemeCln;
	
	@RequestMapping("/ws/gettheme.do")
	public void testGetTheme() {
		GetThemeRequest req = new GetThemeRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getthemeCln.test(req);
	}
	
	@Autowired
	GetMainMenuClient getMMenuCln;
	
	@RequestMapping("/ws/getmmenu.do")
	public void testGetMainMenu() {
		GetMainMenuRequest req = new GetMainMenuRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getMMenuCln.test(req);
	}
	
	@Autowired
	GetChargeCategoriesClient getCCCln;
	
	@RequestMapping("/ws/getcc.do")
	public void testGetChargeCategories() {
		GetChargeCategoriesRequest req = new GetChargeCategoriesRequest();
		req.setFcsUserId(LoginClient.userId);
		req.setWsSessionId(LoginClient.sessionId);
		getCCCln.test(req);
	}
	
	@Autowired
	InterfaceStatusClient isCln;
	
	@RequestMapping("/ws/is.do")
	public void testInterfaceStatus() {
		InterfaceStatusRequest req = new InterfaceStatusRequest();
		req.setDeviceId("d1d1");
		req.setResortId("r1");
		req.setStatus("YES");
		isCln.test(req);
	}

}
